﻿using System;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //通过分析34 * 86 = 43 * 68,做因式分解得到：34 * 43 * 2 = 43 *34 *2
            //然后发现逻辑是 任意两位数 * 两位数个位十位互换*2 = 两位数互换*第二个数的两位互换
            for (int i = 11; i < 100; i++)
            {
                if (i % 10 == 0)
                {
                    continue;
                }
                int res = Reverse(i);
                int v1 = i * res * 2;
                int v2 = res * Reverse(res * 2);
                if (v1 != v2 || res * 2 > 99)
                {
                    continue;
                }
                Console.WriteLine($"{i}*{res * 2} = {res}*{Reverse(res * 2)} --->{v1}={v2}");
            }
        }
        private static int Reverse(int num)
        {
            return num % 10 * 10 + num / 10;
        }



        /// <summary>
        /// 此题使用动态规划解决
        /// </summary>
        /// <param name="n"></param>
        /// <param name="m"></param>
        /// <returns></returns>
        private static int Cal(int n, int m)
        {
            //定义硬币类型
            int[] coins = new int[4] { 1, 2, 5, 10 };
            //第一维为硬币数量，第二维是总和值,d[0][0]默认值为1
            int[][] dp = new int[n + 1][];
            for (int i = 0; i < dp.Length; i++)
            {
                dp[i] = new int[m + 1];
            }
            dp[0][0] = 1;

            //绘制表单
            foreach (int coin in coins)
            {
                for (int i = 1; i <= n; i++)
                {
                    for (int j = coin; j <= m; j++)
                    {
                        dp[i][j] += dp[i - 1][j - coin];
                    }
                }
            }
            //取结果
            return dp[n][m];
        }
    }
}
